package com.lottery.ruok.lottrey.activity;

import android.os.Bundle;
import android.widget.ImageView;

import com.lottery.ruok.lottrey.R;
import com.lottery.ruok.lottrey.retrofitModule.RetrofitBase;
import com.lottery.ruok.lottrey.retrofitModule.RxHelper;
import com.lottery.ruok.lottrey.retrofitModule.RxSubscribe;
import com.lottery.ruok.lottrey.retrofitModule.request.GetHasSMSRequest;
import com.lottery.ruok.lottrey.retrofitModule.response.GetHasSMSResponse;

import butterknife.BindView;
import butterknife.ButterKnife;
import glideHelp.GlideHelper;
/*
* 关于我们
* */

public class AboutActivity extends BaseActivity {


    @BindView(R.id.logo_img)
    ImageView logoImg;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);
        ButterKnife.bind(this);

        getLogoInfo();
    }

    private void getLogoInfo() {
        RetrofitBase.getRetrofit().create(GetHasSMSRequest.class).getResult("app_logo")
                .compose(RxHelper.<GetHasSMSResponse>handleResultReConnection())
                .subscribe(new RxSubscribe<GetHasSMSResponse>(this) {
                    @Override
                    protected void _onNext(GetHasSMSResponse getHasSMSResponse) {
                        if (getHasSMSResponse != null && getHasSMSResponse.getValue() != null) {
                            if (getHasSMSResponse.getValue().getAsJsonObject().get("list") != null) {
                                if (getHasSMSResponse.getValue().getAsJsonObject().get("list").getAsJsonObject().get("mobile_logo").getAsString() != null) {
                                    GlideHelper.loadImage(AboutActivity.this, getHasSMSResponse.getValue().getAsJsonObject().get("list").getAsJsonObject().get("mobile_logo").getAsString(), logoImg);
                                }
                            }
                        }
                    }

                    @Override
                    protected boolean showDialog() {
                        return false;
                    }
                });
    }
}
